<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>websocket演示</title>
</head>
<body>
这是一个thymeleaf页面。
<p>
    欢迎你 ：XXX
</p>
</body>
<script>
    var websocket = null;

    //判断当前浏览器是否支持WebSocket
    if('WebSocket' in window){
        websocket = new WebSocket("ws://localhost:8091");
        websocket.onopen = function () {
            websocket.send("Hello Tio WebSocket");
        }
    } else{
        alert('Not support websocket')
    }
</script>
</html>